package net.da.tools;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 * This utility class is a simple way to have TopLink generate the database
 * schema.
 *
 * @author DDZ
 */
public class DDLGenerator {

    public DDLGenerator() {
    }

    public static void main(String args[]) {
        Map properties = new HashMap();
//        properties.put("toplink.ddl-generation", "create-tables");
        properties.put("toplink.ddl-generation", "drop-and-create-tables");
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("default", properties);
        emf.createEntityManager().close();
        emf.close();
        System.out.println("Data generation finished successfuly.");
    }

}
